<template>
  <div class="chart-main-card">
    <div class="box-name">检测数据</div>
    <div class="card-list">
      <div class="card-item" v-for="item in options" :key="item.prop">
        <div class="number">{{ data[item.prop] }}</div>
        <div class="name">
          <div class="label">{{ item.name }}</div>
          <div class="util">/{{ item.util }}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  components: {},
  data() {
    return {
      data: {
        hedao: 1,
        code2: 1,
        ai: 1524,
        weizhan: 2452,
        wantan: 2146,
      },
      options: [
        {
          name: "航行中",
          util: "艘",
          prop: "hedao",
        },
        {
          name: "靠泊中",
          util: "艘",
          prop: "code2",
        },
        {
          name: "总里程",
          util: "NM",
          prop: "ai",
        },
        {
          name: "总耗油",
          util: "T",
          prop: "weizhan",
        },
        {
          name: "二氧化碳总排放",
          util: "T",
          prop: "wantan",
        },
      ],
    };
  },
  methods: {
    handleDetail(val) {
      this.$emit("goMap", val);
    },
    getData() {},
  },
  mounted() {
    this.getData();
  },
};
</script>

<style scoped lang="scss">
.chart-main-card {
  background-image: url("/img/screen/card1.png") !important;
  display: flex;
  padding: 15px;
  .box-name {
    width: 20px;
    height: 100%;
    color: #fff;
    font-size: 16px;
    margin: 0 10px;
  }
  .card-list {
    display: flex;
    width: calc(100% - 40px);
    color: #fff;
    .card-item {
      margin: 5px 0;
      width: 20%;
      text-align: center;
      border-right: 1px dotted #6cf;
      &:last-of-type {
        border: 0;
      }
      .number {
        color: #6cf;
        font-size: 20px;
        height: 70%;
        display: flex;
        justify-content: center;
        align-items: center;
      }
      .name {
        height: 30%;
        display: flex;
        justify-content: center;
        align-items: center;
        font-size: 14px;
        .label {
          margin-right: 3px;
        }
        .util {
          font-size: 12px;
          color: #6cf;
        }
      }
    }
  }
}
</style>
